#include "Headers.h"
#include "PlayScene.h"


CPlayScene::CPlayScene(void)
{
	m_nScene = 104;
}


CPlayScene::~CPlayScene(void)
{
}
bool CPlayScene::Initialize()
{
	IS_FALSE(m_TileMapManager.Initiallize());
	IS_FALSE(m_Character.Initialize(&m_TileMapManager,33*m_TileMapManager.GetTileMap_Width()+3));
	return true;
}

void CPlayScene::Uninitialize()
{
	m_TileMapManager.UnInitiallize();
	m_Character.Uninitialize();
}

void CPlayScene::Process()
{
	if(InputManager()->GetKeyState('Z') == KEY_DOWN)
	{
		CScene* temp = Application()->GetSceneManager()->GetCurrentScene();
		Application()->GetSceneManager()->GetSceneStack()->push_front(temp);
		Application()->GetSceneManager()->ChangeScene(MENU);
		return;
	}
	static int place = 0;
	m_Character.Process();
	CAMERA()->Process();

	if( InputManager()->GetKeyState(VK_RETURN) == KEY_DOWN )
	{
		if( ++place >= m_TileMapManager.GetTileMap_Number() )
		{
			place = 0;
		}
		m_TileMapManager.SetCurrentPlace(place);
	}
}

void CPlayScene::Render(HDC hdc)
{
	m_TileMapManager.Render(hdc);
	m_Character.Render(hdc);
}